package pl.com.like.sequoia.model.bio.enums;

/**
 * Type of data saved in database
 * @author Pawel Wolanski
 *
 */
public enum SourceType {

	INTERNET("I"), USER("U");
	
	private String fileType;
	
	private SourceType(String type) {
		fileType = type;
	}
	
	public String toDbValue() {
		return fileType;
	}
	
	public SourceType fromDbValue(String dbValue) {
		for (SourceType value : values()) {
			if (value.fileType.equals(dbValue)) {
				return value;
			}
		}
		return defaultValue();
	}
	
	private SourceType defaultValue() {
		return INTERNET;
	}
}
